package com.my.study.io.transformation;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * @author Carlos
 * @version 1.0
 * @Description 字节流 -> 字符流
 *
 * 关闭最外层流
 *
 * @date 2021/6/27 11:34
 **/
public class InputStreamReaderTest {


    private static final String PATH = "D:/file/transformation.txt";

    public static void main(String[] args) {

        // 转换流
        InputStreamReader isr = null;
        BufferedReader br = null;
        try {
            isr = new InputStreamReader(new FileInputStream(PATH), "gbk");
            br = new BufferedReader(isr);

            String s = br.readLine();
            System.out.println(s);

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }

}
